﻿using System;
using BusinessObject;
using Model;

namespace ViewLayer.Pages.Epics
{
    public partial class Importacao : System.Web.UI.Page
    {
        User user;

        protected void Page_Load(object sender, EventArgs e)
        {
            user = (User)Session["User"];
            if (user == null)
            {
                Response.Redirect("../Account/Login.aspx");
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            pnlMessage.Visible = true;
            if (uploadFileEpics.HasFile)
            {
                try
                {
                    EpicBO.Instance.Import(uploadFileEpics.PostedFile, Session["Project"] as Project);
                    lblSuccess.Visible = true;
                }
                catch (Exception exc)
                {
                    lblError.Text = exc.Message;
                    lblError.Visible = true;
                }
            }
            else
            {
                lblError.Text = "Favor selecionar um arquivo";
                lblError.Visible = true;
            }

        }

    }
}